package com.playball.lottery.frm.ads;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.TextView;

import com.playball.lottery.R;
import com.playball.lottery.base.BaseActivity;
import com.playball.lottery.nt.GetJsonData;
import com.playball.lottery.util.LotConstants;


public class AdvZx extends BaseActivity implements LotConstants {

	private WebView webView;
	private Button top_title_back;
	private Button top_title_refres;
	private TextView textView;

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			if (webView.canGoBack()) {
				webView.goBack();
			} else {
				finish();
			}
			return true;
		} else {
			return super.onKeyDown(keyCode, event);
		}
	}

	public void onResume() {
		super.onResume();
		
	}

	public void onPause() {
		super.onPause();
		
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.adv_zx);

		textView = (TextView) findViewById(R.id.top_title_info);
		textView.setText("资讯");

		top_title_refres = (Button) findViewById(R.id.top_title_refres);
		top_title_refres.setVisibility(View.GONE);
		top_title_back = (Button) findViewById(R.id.top_title_back);
		top_title_back.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});

		webView = (WebView) findViewById(R.id.webzx);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
		webView.setWebViewClient(new WebViewClient() {
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				view.loadUrl(url);
				return true;
			}
		});

		webView.loadUrl(GetJsonData.zxPath);
	}

}
